package com.util;


import java.util.Vector;

import javax.swing.table.AbstractTableModel;

public class MyTableModel extends AbstractTableModel {
	private static final long serialVersionUID = -3715669738973547395L;
	private Vector<Vector<Object>> dataValues;
	private Vector <String> columnNames;

	public MyTableModel(Vector<Vector<Object>> dataValues,Vector <String> columnNames) {
		this.dataValues=dataValues;
		this.columnNames=columnNames;
	}

	public int getRowCount() {
		return dataValues.size();

	}

	public int getColumnCount() {
		return columnNames.size();

	}

	public Object getValueAt(int rowIndex, int columnIndex) {
		return dataValues.get(rowIndex).get(columnIndex);

	}

	public String getColumnName(int column) {
		return columnNames.get(column);

	}

	public Class<?> getColumnClass(int columnIndex) {
		return getValueAt(0, columnIndex).getClass();

	}

	public boolean isCellEditable(int rowIndex, int columnIndex) {
			return false;
	}

	public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
		    dataValues.get(rowIndex).remove(columnIndex);
		    dataValues.get(rowIndex).add(columnIndex, aValue);
	        fireTableCellUpdated(rowIndex, columnIndex);

	}

	

	
}
